/**
 * Copyright ©2012-2018 HopeHaiyang Corporation, All Rights Reserved
 * http://www.wuhanhope.com
 */
package hujia.profile.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * class info
 *
 * @author hujia
 *         Create at 2018/7/31 9:21
 */
@EnableWebSecurity
@Configuration
//public class WebSecurityConfig extends GlobalAuthenticationConfigurerAdapter {
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Autowired
    private AuthenticationProvider authenticationProvider;

    public void configure(AuthenticationManagerBuilder au) throws Exception {
        au.authenticationProvider(authenticationProvider);
    }

    public void configure(HttpSecurity http) throws Exception {
        http.anonymous().disable()
                .authorizeRequests().antMatchers("/oauth/token").permitAll();
    }

}
